import { composeMockedListQueryResult, composeMockedQueryResult } from '@sb/webapp-api-client/tests/utils';

import { {{ pascalCase name }}DetailsQuery } from '../../routes/{{ pascalCase name }}/{{ pascalCase name }}Details/{{ pascalCase name }}Details.component';
import { {{ pascalCase name }}ListQuery } from '../../routes/{{ pascalCase name }}/{{ pascalCase name }}List/{{ pascalCase name }}List.component';
import { edit{{ pascalCase name }}Query } from '../../routes/{{ pascalCase name }}/edit{{ pascalCase name }}/edit{{ pascalCase name }}.graphql';

export const fill{{ pascalCase name }}DetailsQuery = (
  data = {
    name: 'Demo item name',
  },
  variables = {}
) => {
  return composeMockedQueryResult({{ pascalCase name }}DetailsQuery, {
    variables,
    data: {
      {{ pascalCase name }}: data,
    },
  });
};

export const fillEdit{{ pascalCase name }}Query = (
  data: object = {
    name: 'Default name',
  },
  variables = {}
) => {
  return composeMockedQueryResult(edit{{ pascalCase name }}Query, {
    data: {
      {{ pascalCase name }}: data,
    },
    variables,
  });
};

export const fill{{ pascalCase name }}ListQuery = (
  data = [
    { id: 1, name: 'First item' },
    { id: 2, name: 'Second item' },
  ]
) => {
  return composeMockedListQueryResult({{ pascalCase name }}ListQuery, 'all{{ pascalCase name }}s', '{{ pascalCase name }}Type', {
    data,
  });
};
